#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;

int n, m;

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);

    int T;
    scanf("%d", &T);
    while(T--){
        scanf("%d%d", &n, &m);
        if(n > m){
            printf("No\n");
            continue;
        }
        if(n == 1){
            printf("Yes\n");
            printf("%d\n", m);
            continue;
        }

        if(n % 2){
            printf("Yes\n");
            for(int i = 1; i <= n - 1; i ++){
                printf("1 ");
            }
            printf("%d\n", m - n + 1);
        }else{
            int k = m - n;
            if(k % 2){
                printf("No\n");
            }else{
                printf("Yes\n");
                for(int i = 1; i <= n - 2; i ++){
                    printf("1 ");
                }
                printf("%d %d\n", 1 + k/2, 1+k/2);
            }
        }
    }

    return 0;
}